body {
  margin: 0;
  padding: 0;
  background-color: #262626;
}

ul {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  display: flex;
}

ul li {
  list-style: none;
}

ul li a {
  position: relative;
  display: block;
  width: 150px;
  height: 80px;
  line-height: 80px;
  text-align: center;
  font-size: 22px;
  color: #fff;
  font-family: sans-serif;
  text-decoration: none;
  border: 1px #000 solid;
  border-right: none;
  transition: 0.5s;
}
ul li:last-child a {
  border-right: 1px #000 solid;
}

ul li a:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f00;
  overflow: hidden;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s ease-in-out;
}

ul li a:hover:before {
  transform-origin: left;
  transform: scaleX(1);
}

ul li:nth-child(1) a:before {
  background-color: #3b5999;
}
ul li:nth-child(2) a:before {
  background-color: #55acee;
}
ul li:nth-child(3) a:before {
  background-color: #dd4b39;
}
ul li:nth-child(4) a:before {
  background-color: #0077b5;
}
ul li:nth-child(5) a:before {
  background-color: #e4405f;
}
